package com.example.zhaccount;

import com.example.activity.UserNameActivity;
import com.example.application.BaseActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;

public class SplashActivity extends BaseActivity {
	private Handler mHandler = new Handler();
	private Runnable run;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		
		mHandler.postDelayed(run = new Runnable() {
			
			@Override
			public void run() {
				Intent it = new Intent(SplashActivity.this, UserNameActivity.class);
				startActivity(it);
				finish();
			}
		}, 3000);
	}

	
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_UP) {
			Intent it = new Intent(SplashActivity.this, UserNameActivity.class);
			startActivity(it);
			finish();
			if (run != null) {
				mHandler.removeCallbacks(run);
			}
		}
		return super.onTouchEvent(event);
	}
}
